package org.deng.vertx.web.verticle;

import io.vertx.core.AbstractVerticle;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author: DengLibin
 * @Date: Create in 2022-04-30 15:03:51
 * @Description: 
 */
@Slf4j
public class HelloVerticle extends AbstractVerticle{
    
    @Override
    public void start() throws Exception {
        log.info("HelloVerticle start方法");
        //接收消息
        vertx.eventBus().consumer("hello.vertx.addr", msg->{
            log.info("HelloVerticle收到消息");
            msg.reply("Hello Vetx.x World");
        });
        //接收消息
        vertx.eventBus().consumer("hello.named.addr", msg -> {
            String name = (String)msg.body();
            log.info("HelloVerticle收到消息,name={}", name);
            msg.reply(String.format("Hello %s", name));
        });
    }
}
